<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport" />
    <meta content="telephone=no" name="format-detection" />
    <title>注册</title>
    <link href="{{ static('css/main.css') }}" rel="stylesheet" type="text/css">
    <link href="{{ static('css/style.css') }}" rel="stylesheet" type="text/css">
    <link href="{{ static('css/shake.css') }}" rel="stylesheet" type="text/css">
    <link href="{{ static('css/font-awesome.min.css') }}" rel="stylesheet" type="text/css">
    <link href="{{ static('css/animate.min.css') }}" rel="stylesheet" type="text/css">
    <link href="{{ static('css/idangerous.swiper.css') }}" rel="stylesheet" type="text/css">
    <script type="text/javascript" src="{{ static('js/jquery-1.8.3.min.js') }}"></script>
    <script type="text/javascript" src="{{ static('js/wo.js') }}"></script>
</head>
<body style="background-color: #fff !important;">
<div class="warpe">
    <div class="head">
        <a href="#" class="return"><i class="icon-chevron-left"></i> 返回</a>
        注册
    </div>
    <div class="main">
        <div class="part part2 margin_top" style="margin-bottom: 0rem;">
            <ul>
                <li class="animated fadeInRight">
                    <input type="text" id="name" placeholder=""
                           onblur="if(this.value.replace(/^ +| +$/g,'')==='')alert('不能为空!')">
                    <label class="puff_left">姓名：</label>
                </li>
                <li class="animated fadeInLeft">
                    <div class="radio_bth">
                        <label><input type="radio" name="radio">男</label>
                        <label><input type="radio" name="radio">女</label>
                    </div>
                    <label class="puff_left">性别：</label>
                </li>
                <li class="animated fadeInRight">
                    <input type="text" id="nickname" placeholder="方便社区交流" class="text_r">
                    <label class="puff_left">昵称：</label>
                </li>
                <li class="animated fadeInLeft">
                    <input type="password" id="password"  placeholder="6~20位数字英文组合" class="text_r"
                            onkeyup="value=value.replace(/[\W]/g,'') "
                            onbeforepaste="clipboardData.setData('text',clipboardData.getData('text')
                            .replace(/[^\d]/g,''))">
                    <label class="puff_left">设置密码：</label>
                </li>
                <li class=" animated fadeInRight">
                    <input type="password" id="password2" placeholder=""
                    onkeyup="value=value.replace(/[\W]/g,'') "
                            onbeforepaste="clipboardData.setData('text',clipboardData.getData('text')
                            .replace(/[^\d]/g,''))">
                    <label class="puff_left">确认密码：</label>
                </li>
            </ul>
        </div>
    </div>
    <div class="id_bth inersest_bth animated bounceIn">
{#        <a href="#">提 交</a>#}
        <input class="mz-btn btn-success" name="reg" id="register" value="提交">
    </div>
</div>
<script type="text/javascript">

    $('#register').click(function (e) {
        var username = document.getElementById("name").value;
        var nickname = document.getElementById("nickname").value;
        var password = document.getElementById("password").value;
        var password2 = document.getElementById("password2").value;


        if(password === ""){
            alert("密码不能为空");
            return false;
            }
        if(password.length < 6){
            alert("密码的长度太短，应大于6");
            return false;
            }
        if(password.length > 12){
            alert("密码的长度太长，应该小于12");
            return false;
            }
        {#var pwd2  = document.getElementById("pwd2").value;#}
        if(password !== password2){
            alert("两次输入的密码不一样，请重新输入");
            return false;
            }


        $.ajax({
            url : '/register2/',
            data : {
                'username' : username,
                'nickname' : nickname,
                'password' : password,
                'password2' : password2,
                {#'sex': item,#}
            },

            type : 'POST',
            success: function(data){
                if (data.errno == '0') {
                    alert(data.errmsg);
                    window.location.href = "{{ url('users:login') }}";
                } else {
                    alert(data.errmsg);
                }
            }
        })
    })


</script>

</body>
</html>

